<?php
//对会员中心的操作（主要是对订单页的操作）
class MemberControl extends Control{
	// 会员中心默认显示的页面
	public function index(){
		// p($_SESSION);
		// 每个用户订单表的数据
		$data=M("order2")->where(array('uid'=>$_SESSION['user']['uid']))->all();
		// p($data);
		//获得用户订单列表的数据
		foreach ($data as $n=>$d){
			$order_list=M('order_list')->where(array('order_num'=>$d['order_num']))->all();
			//得到库存的内容图片
			foreach($order_list as $K=>$order_stock){
				$stock=M('stock')->where(array('st_id'=>$order_stock['good_stock_id']))->find();
				$goods=M('goods')->where(array('gid'=>$stock['goods_gid']))->find();
				$order_list[$K]['pic']=$goods['list_pic'];//获得到库存的图片得地址
				$order_list[$K]['gid']=$goods['gid'];
			}

			$data[$n]['order_list']=$order_list;
		}
		// p($data);

		$this->assign('data',$data);
		$this->display('myself');
	}
}